package com.yun.service.impl;

import com.yun.entity.StatisticsScoreTarget;
import com.yun.mapper.StatisticsScoreTargetMapper;
import com.yun.service.SeparateManagementSystemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (StatisticsScoreTarget)表服务实现类
 *
 * @author makejava
 * @since 2021-10-27 16:18:36
 */
@Service("SeparateManagementSystemService")
public class SeparateManagementSystemServiceImpl implements SeparateManagementSystemService {
    @Resource
    private StatisticsScoreTargetMapper statisticsScoreTargetMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param scoreTargetId 主键
     * @return 实例对象
     */
    @Override
    public StatisticsScoreTarget queryById(Integer scoreTargetId) {
        return this.statisticsScoreTargetMapper.queryById(scoreTargetId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<StatisticsScoreTarget> queryAllByLimit(int offset, int limit) {
        return this.statisticsScoreTargetMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param statisticsScoreTarget 实例对象
     * @return 实例对象
     */
    @Override
    public StatisticsScoreTarget insert(StatisticsScoreTarget statisticsScoreTarget) {
        this.statisticsScoreTargetMapper.insert(statisticsScoreTarget);
        return statisticsScoreTarget;
    }

    /**
     * 修改数据
     *
     * @param statisticsScoreTarget 实例对象
     * @return 实例对象
     */
    @Override
    public StatisticsScoreTarget update(StatisticsScoreTarget statisticsScoreTarget) {
        this.statisticsScoreTargetMapper.update(statisticsScoreTarget);
        return this.queryById(statisticsScoreTarget.getScoreTargetId());
    }

    /**
     * 通过主键删除数据
     *
     * @param scoreTargetId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer scoreTargetId) {
        return this.statisticsScoreTargetMapper.deleteById(scoreTargetId) > 0;
    }
}